
function i(e) {
            var t, a = (t = "",
            ["66", "72", "6f", "6d", "43", "68", "61", "72", "43", "6f", "64", "65"].forEach((function(e) {
                t += unescape("%u00" + e)
            }
            )),
            t);
            return String[a](e)
        }

n = {
  cv: function (e) {
        return function(e) {
            try {
                return btoa(e)
            } catch (t) {
                return Buffer.from(e).toString("base64")
            }
        }(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, (function(e, t) {
            return i("0x" + t)
        }
        )))
  },
    oZ: function g(e, t) {
            t || (t = s());
            for (var a = (e = e.split("")).length, n = t.length, o = "charCodeAt", r = 0; r < a; r++)
                e[r] = i(e[r][o](0) ^ t[(r + 10) % n][o](0));
            return e.join("")
        },
    nF: function v(e, t, a) {
            var n, o, r = void 0 === a ? 2166136261 : a;
            for (n = 0,
            o = e.length; n < o; n++)
                r ^= e.charCodeAt(n),
                r += (r << 1) + (r << 4) + (r << 7) + (r << 8) + (r << 24);
            return t ? ("0000000" + (r >>> 0).toString(16)).substr(-16) : r >>> 0
        }
}

var l = (0,
        n.nF)("qimai|Technologyx", 1)

function get_analysis(e) {
    f = -307
    h = "analysis"
    d = "@#"
    var a, o = +new Date - (f || 0) - 1515125653845, r = [];
    return void 0 === e.params && (e.params = {}),
    Object.keys(e.params).forEach((function(t) {
        if (t == h)
            return !1;
        e.params.hasOwnProperty(t) && r.push(e.params[t])
    }
    )),
    r = r.sort().join(""),
    r = (0,
    n.cv)(r),
    r += d + e.url.replace(e.baseURL, ""),
    r += d + o,
    r += d + 1,
    a = (0,
    n.cv)((0,
    n.oZ)(r, l)),
    -1 == e.url.indexOf(h) && (e.url += (-1 != e.url.indexOf("?") ? "&" : "?") + h + "=" + encodeURIComponent(a)),
            e
    // console.log("r:", r)
    // return sss

}
e = {
    url: 'https://api.qimai.cn/rank/index',

    // params: {brand: 'free', device: 'iphone', country: 'cn', genre: '36'},
    params: {brand: 'paid', device: 'ipad', country: 'cn', genre: '36'},
    baseURL: 'https://api.qimai.cn'
}

console.log(get_analysis(e))


function data(url, params){
    return get_analysis({"url": url, "params": params, "baseURL": 'https://api.qimai.cn'})
}


console.log(data("/rank/index", {
    "brand": "free",
    "device": "iphone",
    "country": "cn",
    "genre": "36",
    "date": "2022-06-30",
    "page": "2",
    "is_rank_index": "1",
    "snapshot": "08:53:04"
}))
/*
{
  url: '/rank/index?analysis=eCBfA3hkfQZ9dGFILl16QilSfEJ9dGlEfUpxGXleexFiW3xcamdcR1F3WkJpZFkFdRUfQlFeWx9ZDVNWTSQbBAIBBAIHAwkJWgALdUcJ',
  params: {
    brand: 'free',
    device: 'iphone',
    country: 'cn',
    genre: '36',
    date: '2022-06-30',
    page: '2',
    is_rank_index: '1',
    snapshot: '08:53:04'
  },
  baseURL: 'https://api.qimai.cn'
}
*/
